package com.cloud.lan.service.task;

import com.cloud.lan.service.ILanActivityService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * 定时任务
 * @author ErKang
 * @date Created in 2022/1/6 01:06
 * @title TestTask.java
 * Department: Product development
 */
@Component
@Configuration
@Slf4j
@EnableScheduling
public class LanActivityTask {

    @Autowired
    private ILanActivityService lanActivityService;

    /**
     * 每*分钟执行一次
     */
    @Scheduled(cron = "0 0/60 * * * ?")
    private void cancelOrderTask() {
        try {
            lanActivityService.adjustActivity();
            log.info("#定时任务 adjustActivity 完成");
        } catch (Exception e) {
            log.error("#定时任务 错误 :", e);
        }
    }
}
